Skip to content

chore: remove unnecessary .unwrap() calls - #256

Merged
barjin merged 2 commits into
masterfrom
chore/fewer-unwraps
Sep 2, 2025
Merged

barjin merged 2 commits into
masterfrom
chore/fewer-unwraps

Conversation

@barjin

@barjin barjin commented Sep 2, 2025

Copy link
Copy Markdown
Member

Lowers the risk of rogue panics by removing the unnecessary (and potentially dangerous) .unwrap() calls in Impit codebase.

@barjin
barjin requested a review from Copilot September 2, 2025 11:06
@barjin barjin added the adhoc Ad-hoc unplanned task added during the sprint. label Sep 2, 2025
@barjin barjin self-assigned this Sep 2, 2025
@github-actions github-actions Bot added this to the 122nd sprint - Tooling team milestone Sep 2, 2025
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Sep 2, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes unnecessary .unwrap() calls throughout the Impit codebase to prevent potential runtime panics and improve error handling. The changes replace risky unwrap calls with safer alternatives like fallback values, proper error propagation, and explicit error handling.

  • Replaces .unwrap() calls with safer alternatives like .unwrap_or_default() and explicit match statements
  • Improves error handling by returning proper error types instead of panicking
  • Updates function signatures to return Result types where appropriate for better error propagation

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
impit/src/impit.rs Replaces unwrap calls with match statements and fallback values for URL parsing and HTTP3 engine handling
impit-python/src/cookies.rs Converts unwrap calls to unwrap_or_default and changes function signature to return PyResult
impit-python/src/client.rs Updates cookie jar initialization to properly handle errors from the changed function signature
impit-python/src/async_client.rs Updates async cookie jar initialization with proper error propagation
impit-node/src/response.rs Replaces unwrap with explicit error handling for response property access
impit-node/src/request.rs Improves error handling in async operations and removes unwrap from threadsafe function building

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread impit-python/src/cookies.rs
Comment thread impit-python/src/cookies.rs
Comment thread impit-node/src/response.rs
@barjin
barjin merged commit 9f2579a into master Sep 2, 2025
46 checks passed
@barjin
barjin deleted the chore/fewer-unwraps branch September 2, 2025 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants